#pragma once

#include <iostream>
#include <format>
#include <string_view>
#include <string>

namespace format_test
{
	template <typename... Args>
	std::string dyna_print(std::string_view rt_fmt_str, Args&&... args) {
		return std::vformat(rt_fmt_str, std::make_format_args(args...));
	}

	void UseFormatTest()
	{
		std::cout << std::format("{} Hello {}!\n", 2.0, "world");

		std::string fmtstr;
		for (int i{}; i != 3; ++i) {
			fmtstr += "{} "; // constructs the formatting string
			std::cout << fmtstr << " : ";
			std::cout << dyna_print(fmtstr, "alpha", 'Z', 3.14, "unused");
			std::cout << '\n';
		}
	}
}